package com.common.constants;

import java.util.regex.Pattern;

/**
 * @Brief 正则表达式常量池
 * @Author chenyl
 * @Date 2023-08-07
 * @Version 1.0.0
 */
public class RegularExpressionConstantPool {
    /**
     * 纯数字
     */
    public static final Pattern PURE_NUMBERS = Pattern.compile("\\d+");
    /**
     * 纯字母
     */
    public static final Pattern PURE_LETTER = Pattern.compile("[A-z]+");
    /**
     * 整数
     */
    public static final Pattern INTEGER = Pattern.compile("^[-\\+]?[\\d]+$");
    /**
     * 时间基本格式
     */
    public static final Pattern DATE_TIME_FORMAT = Pattern.compile("^(\\d{4}(-\\d{1,2}-|[/]\\d{1,2}[/]|\\d{1,2})\\d{1,2})\\s\\d{1,2}:\\d{1,2}(:\\d{1,2})?$");
    /**
     * 时间格式：年月日
     */
    public static final Pattern DATE_FORMAT = Pattern.compile("^\\d{4}(-\\d{1,2}(-\\d{1,2})?|[/]\\d{1,2}([/]\\d{1,2})?|\\d{1,2}\\d{0,2})$");
    /**
     * 时间格式：时分秒
     */
    public static final Pattern TIME_FORMAT = Pattern.compile("^\\d{1,2}:\\d{1,2}(:\\d{1,2})?$");
}
